using System;

namespace Rioshu.Web.ViewStateHandlers
{
    public static class PersisterLoader
    {
        public static IViewStateHandlersPersister LoadPersister(string typeName)
        {
            var type = Type.GetType(typeName);
            
            if (type != null && type.IsImplementationOf<IViewStateHandlersPersister>()) {
                return Activator.CreateInstance(type) as IViewStateHandlersPersister;
            }

            return null;
        }
    }
}